$(document).ready(function(){
	$("#txtds_respons").autocomplete({
			source: function(request, response) {
			
				$.ajax({
					url: jQuery.scriptPath +'index.php/Persona/busquedaper/',
					dataType: "json",
					data: request,
					success: function(data) {
						response(data);
					}
				});
			},
			minLength: 2,
			select: function(event, ui) {
				//$(this).data('id', ui.item.id);
				//alert($(this).data("id"));
				$('#hd_cod_pers').val(ui.item.id);
				//alert(ui.item ? ("Selected: " + ui.item.value + " aka " + ui.item.id) : "Nothing selected, input was " + this.value);
			}
		});
});

function ExecActionMante(type){
	paramet  = $("#dialog-form").find("select, textarea, input,hidden").serialize();
	//alert(paramet);
	st_stado = '1';
	//return false;
	$.ajax({
 		dataType: "html",
	 	type: "POST",
	 	url: jQuery.scriptPath +'index.php/Proveedor/executemante/',
	 	data: "type="+type+"&"+paramet+'&st_stado='+st_stado,
		beforeSend: function(data){

		},
		success: function(requestData){
			//alert(requestData); 	
			$("#result").html(requestData);
		},		
		error: function(requestData, strError, strTipoError){											
			$("#result").html("Error " + strTipoError +": " + strError);
			//alert("Error " + strTipoError +": " + strError);
		}
	});
}
